001 /*
002 * Copyright 2005 Niclas Hedhman
003 * Copyright 2005-2006 Stephen J. McConnell
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
014 * implied.
015 *
016 * See the License for the specific language governing permissions and
017 * limitations under the License.
018 */
019
020 package net.dpml.transit.link;
021
022 import java.io.IOException;
023
024 import java.net.URL;
025 import java.net.URLConnection;
026 import java.net.URLStreamHandler;
027
028 /**
029 * The link URL protocol handler.
030 *
031 * The <strong>link:</strong> protocol is similar to the symlink concept
032 * in Linux/Unix, where something that looks like a file points to another
033 * file. In this case, the link URL points to another URL. The resolution
034 * of the link translation is picked up from managed Transit server(s).
035 * @author <a href="http://www.dpml.net">Digital Product Meta Library</a>
036 * @version 1.0.1
037 */
038 public class Handler extends URLStreamHandler
039 {
040 /**
041 * Creation of a new transit link: protocol handler.
042 */
043 public Handler()
044 {
045 }
046
047 // ------------------------------------------------------------------------
048 // implementation
049 // ------------------------------------------------------------------------
050
051 /**
052 * Opens a connection to the specified URL.
053 *
054 * @param url A URL to open a connection to.
055 * @return The established connection.
056 * @throws IOException If a connection failure occurs.
057 */
058 protected URLConnection openConnection( final URL url )
059 throws IOException
060 {
061 return new LinkURLConnection( url );
062 }
063 }